<html>
<body>
    <p>This tests that a javascript: URL loaded in an iframe inside another javascript: URL loaded iframe has access to the main frame.</p>
    <iframe id="aFrame" name="aFrame" style="width: 500px; height: 300px;"></iframe>
    <p id='accessMe'>FAIL: Cross frame access from a javascript: URL inside another javascript: URL was denied.</p>
    <script>
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
            testRunner.dumpChildFrames();
        }

        var innerURL = 'javascript:\\\"<html>'
            + "<scr" + "ipt>"
            +     'top.document.getElementById(\\\\\\\"accessMe\\\\\\\").innerHTML = \\\\\\\"PASS: Cross frame access from a javascript: URL inside another javascript: URL was allowed!\\\\\\\";'
            + "</scri" + "pt>"
            + "<body>"
            +     "<p>Inner-inner iframe.</p>"
            + "</body>"
            + '</html>\\\"';

        var url = "javascript:\"<html>"
            + "<body>"
            +     "<iframe src='" + innerURL + "'></iframe>"
            +     "<p>Inner iframe.</p>"
            + "</body>"
            + "</html>\"";

        var iframe = document.getElementById("aFrame");
        iframe.src = url;
        iframe.addEventListener('load', () => {
          testRunner.notifyDone();
        });
    </script>
</body>
</html>
